#!/bin/bash
set -x

source ./common.sh

cur_dir=$(dirname "$(readlink -f "$0")")

# shellcheck disable=SC2164
pushd "$HARBOR_DIR"
preset
if docker ps --format '{{.Names}}' | grep -q 'harbor'; then
    echo "Harbor容器正在运行,即将停止并移除..."
    docker compose down -v
fi
# shellcheck disable=SC2164
popd

echo "$HOST_PASSWORD" | sudo rm -rf "$HARBOR_DIR"
echo "$HOST_PASSWORD" | sudo rm -rf "$HARBOR_DATA"
echo "$HOST_PASSWORD" | sudo rm -rf "$HARBOR_LOG"
